"use client"
import React, { useState } from "react"
import { Card, CardContent } from "@/components/ui/card"
import { Zap } from "lucide-react"
import LoginForm from "./components/LoginForm"
import RegisterForm from "./components/RegisterForm"

const AuthPage = () => {
  const [isLogin, setIsLogin] = useState(true)

  const onSwitchToRegister = () => {
    setIsLogin(false)
  }

  const onSwitchToLogin = () => {
    setIsLogin(true)
  }

  return (
    <div className="min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 to-indigo-100 dark:from-gray-900 dark:to-gray-800 p-4">
      <div className="w-full max-w-md">
        <div className="text-center mb-8">
          <div className="flex items-center justify-center space-x-3">
            <div className="flex items-center justify-center w-10 h-10 bg-gradient-to-r from-blue-500 to-indigo-600 rounded-lg">
              <Zap className="text-white w-6 h-6" />
            </div>
            <h1 className="text-2xl font-bold text-text-primary">Flow Forge</h1>
          </div>
        </div>

        <Card className="shadow-lg">
          <CardContent className="p-6">
            {isLogin ? (
              <LoginForm onSwitchToRegister={onSwitchToRegister} />
            ) : (
              <RegisterForm onSwitchToLogin={onSwitchToLogin} />
            )}
          </CardContent>
        </Card>

        <div className="text-center mt-6 text-sm text-gray-600 dark:text-gray-400">
          © {new Date().getFullYear()} Flow Forge. 保留所有权利。
        </div>
      </div>
    </div>
  )
}

export default AuthPage
